<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%--
  Created by IntelliJ IDEA.
  User: Wangzs
  Date: 2018/7/6
  Time: 7:43
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!-- Content Header (Page header) -->
<style>
    .panel {
        position: relative;
    }

    .panel .form-group {
        position: relative;
        width: 50%;
        float: left;
    }

    .clear:after {
        content: '';
        display: block;
        clear: both;
    }

    .clear {
        zoom: 1;
    }

    .addcailiao {
        position: absolute;
        right: -20px;
        bottom: 40px;
        z-index: 99;
    }

    .ht_in_jia {
        background: #f63;
        color: white;
    }

    .formspan {
        text-align: right;
    }

    .ht_in_jian {
        border: none;
        padding: 0px 10px;
        fot-size: 18px;
        color: white;
        background: #f63;
        position: absolute;
        right: 60px;
        top: 2px;
    }
</style>
<section class="content-header" style="">
    <h1>
        ${archives.comName}
        <small>详情信息</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
        <li><a href="#">详情信息</a></li>
        <li class="active">${archives.comName}</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <ul class="nav nav-tabs">
        <shiro:lacksRole name="admin">
            <li><a href="#" onclick="loadHref('#archives/archives_user')">档案库</a></li>
        </shiro:lacksRole>
        <shiro:hasAnyRoles name="root,admin">
            <li><a href="#" onclick="loadHref('#archives')">档案库</a></li>
            <li><a href="#"
                   onclick="loadHref('#archives/findByOperateIDView?id=' + ${archives.operateId} + '')">档案库管理</a></li>
        </shiro:hasAnyRoles>

        <li class="active"><a href="#">详情信息</a></li>
    </ul>
    <div class="box">
        <div class="box-body">
            <div class="col-xs-12 col-sm-12">
                <div class="panel panel-default">
                    <div class="panel-heading">企业详情信息</div>
                    <div class="panel-body">
                        <div class="col-md-5">
                            <ul>
                                <li>业务类型：${archives.businessTypeSTR}</li>
                                <li>状态：${archives.statusSTR}</li>
                                <li>企业类别：${archives.comTypeSTR}</li>
                                <%--<li>录入时间：${archives.inputTimeSTR}</li>--%>
                            </ul>
                        </div>
                        <div class="col-md-6">
                            <form id="detailCompany">
                                <input type="hidden" name="id" id="company_archives_id" class="form-control"
                                       value="${archives.id}">

                                <div class="input-group col-xs-5">
                                    <span class="input-group-addon">企业名称</span>
                                    <input type="text" name="comName" class="form-control" value="${archives.comName}"
                                           required>
                                </div>
                                <div class="input-group col-xs-5">
                                    <span class="input-group-addon">营业执照编号</span>
                                    <input type="text" name="businessCode" class="form-control"
                                           value="${archives.businessCode}" required>
                                </div>
                                <div class="input-group col-xs-5">
                                    <span class="input-group-addon">录入时间</span>
                                    <input type="text" name="inputTime" class="form-control  date form_datetime"
                                           value="${archives.inputTimeSTR}" required>
                                </div>
                                <div class="input-group col-xs-5">
                                    <span class="input-group-addon">授信额度</span>
                                    <input type="number" name="creditLine" class="form-control"
                                           value="${archives.creditLine}" required>
                                </div>
                                <div class="input-group col-xs-5">
                                    <span class="input-group-addon">授信期限(年)</span>
                                    <select class="form-control" id="creditLimit_select" name="creditLimit">
                                        <option value="${archives.creditLimit}"
                                                selected>${archives.creditLimit}</option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                    </select>

                                </div>
                            </form>
                            <c:if test="${archives.status eq 5 || archives.status eq 1}">
                                <button type="button" class="btn btn-primary" id="editCompany_ID">修改</button>
                                <button type="button" class="btn btn-primary" id="saveCompany_ID">保存</button>
                            </c:if>
                        </div>
                        <c:if test="${fn:length(archives.tbCompayUploadInfos) eq 0}">
                            <c:if test="${archives.comType eq 1}">
                                <div class="col-sm-2">
                                    <button onclick="mainAddImage(${archives.id})">核心企业初始资料上传(补)</button>
                                </div>
                            </c:if>
                            <c:if test="${archives.comType eq 2}">
                                <div class="col-sm-2">
                                    <button onclick="commonAddImage(${archives.id})">一般企业初始资料上传(补)</button>
                                </div>
                            </c:if>
                            <c:if test="${archives.comType eq 3}">
                                <div class="col-sm-2">
                                    <button onclick="pcomAddImage(${archives.id})">个人初始资料上传(补)</button>
                                </div>
                            </c:if>
                        </c:if>

                        <c:forEach items="${archives.tbCompayUploadInfos}" var="tbCompayUploadInfo">
                            <c:if test="${tbCompayUploadInfo.isDisplay==1}">
                                <div class="col-sm-2">
                                    <c:choose>
                                    <c:when test="${fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.png')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.jpg')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.jpeg')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.gif')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.bmp')}">
                            <div class="images" style="width:114px; height:210px;">
                                        <img src=${tbCompayUploadInfo.picUrl}
                                                     style="width: 110px; height: 110px;">
                                        <br>
                                        <label>${tbCompayUploadInfo.picName}</label>
                                        <br>
                                        <c:if test="${archives.status ==1||archives.status ==5}">
                                            <a href="javascript:updateImage(${tbCompayUploadInfo.id})">修改图片</a>
                                            <c:if test="${tbCompayUploadInfo.isDefined ==1}">
                                                <br><a
                                                    href="javascript:updateOtherName(${tbCompayUploadInfo.id},${archives.id})">修改名称</a>
                                            </c:if>
                                        </c:if>
                                            <%-- <a href="${tbCompayUploadInfo.picUrl}" download="${tbCompayUploadInfo.picName}">
                                                 <img border="0" alt="下载">
                                             </a>--%>
                                        <a href="#" onclick='showhtfun("${tbCompayUploadInfo.picUrl}")'>下载</a>
                                    </div>
                                </c:when>
                                    <c:when test="${empty tbCompayUploadInfo.picUrl}">
                                        <div class="images" style="width:114px; height:210px;">
                                            <%--<img src=${tbCompayUploadInfo.picUrl}
                                                         style="width: 110px; height: 110px;">--%>
                                            <br>
                                            <label>${tbCompayUploadInfo.picName}</label>
                                            <br>
                                            <c:if test="${archives.status ==1||archives.status ==5}">
                                                <a href="javascript:updateImage(${tbCompayUploadInfo.id})">上传图片</a>
                                                <c:if test="${tbCompayUploadInfo.isDefined ==1}">
                                                    <br><a
                                                        href="javascript:updateOtherName(${tbCompayUploadInfo.id},${archives.id})">修改名称</a>
                                                </c:if>
                                            </c:if>
                                                <%-- <a href="${tbCompayUploadInfo.picUrl}" download="${tbCompayUploadInfo.picName}">
                                                     <img border="0" alt="下载">
                                                 </a>--%>
                                            <%--<a href="#" onclick='showhtfun("${tbCompayUploadInfo.picUrl}")'>下载</a>--%>
                                        </div>
                                    </c:when>
                                        <c:otherwise>
                                            <div class="images" style="width:114px; height:210px;">
                                                    <%--<img src=${tbCompayUploadInfo.picUrl}
                                                                 style="width: 110px; height: 110px;">--%>
                                                        <a target="_blank" href=${tbCompayUploadInfo.picUrl}>下载</a>
                                                <br>
                                                <label>${tbCompayUploadInfo.picName}</label>
                                                <br>
                                                <c:if test="${archives.status ==1||archives.status ==5}">
                                                    <a href="javascript:updateImage(${tbCompayUploadInfo.id})">修改文件</a>
                                                    <c:if test="${tbCompayUploadInfo.isDefined ==1}">
                                                        <br><a
                                                            href="javascript:updateOtherName(${tbCompayUploadInfo.id},${archives.id})">修改名称</a>
                                                    </c:if>
                                                </c:if>
                                                    <%-- <a href="${tbCompayUploadInfo.picUrl}" download="${tbCompayUploadInfo.picName}">
                                                         <img border="0" alt="下载">
                                                     </a>--%>
                                               <%-- <a href="#" onclick='showhtfun("${tbCompayUploadInfo.picUrl}")'>下载</a>--%>
                                            </div>
                                                </c:otherwise>
                                    </c:choose>
                                </div>
                            </c:if>
                        </c:forEach>

                        <c:if test="${fn:length(archives.tbCompayUploadInfos) ne 0 || archives.comType eq 0}">
                            <form id="newAddForm" enctype="multipart/form-data" class="form-group" style="width:100%;">
                                <input id="id" type="hidden" name="id" value="${archives.id}">

                            <c:if test="${archives.status eq 5 || archives.status eq 1}">
                                <div class="addcailiao">
                                    <button type="button" class="ht_in_jia btn  pull-right">+ 新增材料</button>
                                </div>
                            </c:if>
                            </form>

                            <div class="box-footer" id="submitImgAddDiv" style="display:none;">
                                <button type="button" class="btn btn-info pull-right" id="submitImgAdd">图片上传
                                </button>
                            </div>
                        </c:if>


                    </div>
                </div>
            </div>
            <div class="col-xs-12 col-sm-12">
                <%--担保方--%>
                <c:forEach items="${archivesGuarantees}" var="guarantees">
                <div class="panel panel-default">
                    <div class="panel-heading">担保企业详情信息</div>
                    <div class="panel-body">
                    <div class="col-md-5">
                        <ul>
                            <li>类别：${guarantees.comTypeSTR}</li>
                            <%--<li>录入时间：${guarantees.inputTimeSTR}</li>--%>
                        </ul>
                    </div>
                    <div class="col-md-6">
                        <form id="detailG${guarantees.id}">
                            <input type="hidden" name="id" class="form-control" value="${guarantees.id}">

                            <div class="input-group col-xs-5">
                                <span class="input-group-addon">担保人名称</span>
                                <input type="text" name="comName" class="form-control"
                                       value="${guarantees.comName}" required>
                            </div>
                            <div class="input-group col-xs-5">
                                <span class="input-group-addon">担保金额</span>
                                <input type="text" name="creditLine" class="form-control"
                                       value="${guarantees.creditLine}" required>
                            </div>
                            <div class="input-group col-xs-5">
                                <span class="input-group-addon">录入时间</span>
                                <input type="text" name="inputTime" class="form-control  date form_datetime"
                                       value="${guarantees.inputTimeSTR}" required>
                            </div>
                            <c:if test="${archives.status ==1||archives.status ==5}">
                                <button type="button" class="btn btn-primary" id="editDetail_ID${guarantees.id}"
                                        onclick="editDetail(${guarantees.id})">修改
                                </button>
                                <button type="button" class="btn btn-success" id="saveDetail_ID${guarantees.id}"
                                        onclick="saveDetail(${guarantees.id},${archives.id})">保存
                                </button>
                            </c:if>
                        </form>
                    </div>
                    <c:if test="${archives.status ==1||archives.status ==5}">
                        <c:if test="${fn:length(guarantees.tbCompayUploadInfos) eq 0}">
                            <c:if test="${guarantees.comType eq 4}">
                                <div class="col-sm-2">
                                    <button onclick="companyAddImage(${guarantees.id},${archives.id})">
                                        企业担保初始资料上传(补)
                                    </button>
                                </div>
                            </c:if>
                            <c:if test="${guarantees.comType eq 5}">
                                <div class="col-sm-2">
                                    <button onclick="personalAddImage(${guarantees.id},${archives.id})">
                                        个人担保初始资料上传(补)
                                    </button>
                                </div>
                            </c:if>
                        </c:if>

                    </c:if>
                    <c:forEach items="${guarantees.tbCompayUploadInfos}" var="uploadInfo">
                        <c:if test="${uploadInfo.isDisplay==1}">
                            <div class="col-sm-2">
                                <c:choose>
                                <c:when test="${fn:containsIgnoreCase(uploadInfo.picUrl, '.png')||fn:containsIgnoreCase(uploadInfo.picUrl, '.jpg')||fn:containsIgnoreCase(uploadInfo.picUrl, '.jpeg')||fn:containsIgnoreCase(uploadInfo.picUrl, '.gif')||fn:containsIgnoreCase(uploadInfo.picUrl, '.bmp')}">
                                <div class="images" style="width:114px; height:210px;">
                                    <img src=${uploadInfo.picUrl}
                                         <%--onerror="this.src='/static/img/avatar.png';this.onerror=null"--%>
                                                 style="width: 110px; height: 110px;">
                                    <br>
                                    <label>${uploadInfo.picName}</label>
                                    <br>
                                    <c:if test="${archives.status ==1||archives.status ==5}">
                                        <a href="javascript:updateImage(${uploadInfo.id})">修改图片</a>
                                        <c:if test="${uploadInfo.isDefined ==1}">
                                            <br><a href="javascript:;"
                                                   onclick="updateOtherName(${uploadInfo.id})">修改名称</a>
                                        </c:if>
                                    </c:if>

                                    <a href="#" onclick='showhtfun("${uploadInfo.picUrl}")'>下载</a>
                                </div>
                                </c:when>
                                <c:when test="${empty uploadInfo.picUrl}">
                                    <div class="images" style="width:114px; height:210px;">
                                        <%--<img src=${uploadInfo.picUrl}
                                                 &lt;%&ndash;onerror="this.src='/static/img/avatar.png';this.onerror=null"&ndash;%&gt;
                                                     style="width: 110px; height: 110px;">--%>
                                        <br>
                                        <label>${uploadInfo.picName}</label>
                                        <br>
                                        <c:if test="${archives.status ==1||archives.status ==5}">
                                            <a href="javascript:updateImage(${uploadInfo.id})">上传图片</a>
                                            <c:if test="${uploadInfo.isDefined ==1}">
                                                <br><a href="javascript:;"
                                                       onclick="updateOtherName(${uploadInfo.id})">修改名称</a>
                                            </c:if>
                                        </c:if>

                                        <%--<a href="#" onclick='showhtfun("${uploadInfo.picUrl}")'>下载</a>--%>
                                    </div>
                                </c:when>
                                    <c:otherwise>
                                        <div class="images" style="width:114px; height:210px;">
                                            <a target="_blank" href=${uploadInfo.picUrl}>下载</a>
                                                <%--<img src=${uploadInfo.picUrl}
                                                         &lt;%&ndash;onerror="this.src='/static/img/avatar.png';this.onerror=null"&ndash;%&gt;
                                                             style="width: 110px; height: 110px;">--%>
                                            <br>
                                            <label>${uploadInfo.picName}</label>
                                            <br>
                                            <c:if test="${archives.status ==1||archives.status ==5}">
                                                <a href="javascript:updateImage(${uploadInfo.id})">上传图片</a>
                                                <c:if test="${uploadInfo.isDefined ==1}">
                                                    <br><a href="javascript:;"
                                                           onclick="updateOtherName(${uploadInfo.id})">修改名称</a>
                                                </c:if>
                                            </c:if>

                                            <%--<a href="#" onclick='showhtfun("${uploadInfo.picUrl}")'>下载</a>--%>
                                        </div>
                                    </c:otherwise>
                                </c:choose>
                            </div>
                        </c:if>
                    </c:forEach>
                    <c:if test="${fn:length(guarantees.tbCompayUploadInfos) ne 0}">
                        <form id="newGuaranteesAddForm" enctype="multipart/form-data" class="form-group"
                              style="width:100%;">
                            <input id="idGuarantees" type="hidden" name="id" value="${guarantees.id}">
                            <c:if test="${archives.status eq 5 || archives.status eq 1}">
                            <div class="addcailiao">
                                <button type="button" class="ht_in_jia btn  pull-right">+ 新增材料</button>
                            </div>
                            </c:if>
                        </form>
                        <div class="box-footer" id="submitImgAddDiv" style="display:none;">
                            <button type="button" class="btn btn-info pull-right tubtn" id="">图片上传
                            </button>
                        </div>
                    </c:if>
                </div>
            </div>
            </c:forEach>
        </div>

        <!-- /.box-body -->
        <%-- <div class="box-footer">
             页脚
         </div>--%>
        <!-- /.box-footer-->
    </div>
    </div>
    <!-- /.box -->
</section>
<!-- /.content -->

<div id="img-modal" class="modal fade">
    <div id="img-dialog" class="modal-dialog" style="width: 98%; height: 98%;text-align: center;">
        <div id="img-content" class="modal-content">
            <img id="img-zoom" src="" style="max-height: 100%; max-width: 100%;margin:10px;">
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<!-- edit Modal -->
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="editModalLabel">证件照片信息</h4>
            </div>
            <div class="modal-body">
                <form id="updateForm" enctype="multipart/form-data">
                    <input type="hidden" name="uploadId" id="upload_id"/>

                    <div class="form-group">
                        <label class="control-label"><span class="asterisk">*</span>上传图片:</label>
                        <input id="input-id1" name="input-id1" type="file" data-show-caption="true" class="imagelimit">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="updateImage"
                <%--data-action="{type:'submit',form:'#updateForm',url:'<%=request.getContextPath()%>/archives/test',after:'$.myAction.refreshContent'}"--%>>
                    确定
                </button>
            </div>
            <div id="J_progress_label" style="display: none;position: absolute;width: 200px;height: 60px;text-align: center;line-height: 60px;top: 0;left: 0;right: 0;bottom: 0;border-radius:15px;margin: auto;box-shadow:0px 0px 5px #e5f9f2;background:#f63;z-index:999;color:white;">

            </div>
        </div>
    </div>
</div>
<!--修改名称-->
<div class="modal fade" id="updateOtherNameModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="editModalLabel">证件照片名称</h4>
            </div>
            <div class="modal-body">
                <form id="updateOtherNameForm" enctype="multipart/form-data">
                    <input type="hidden" name="id" id="uploadName_id"/>
                    <input type="hidden" name="archivesName_Id" id="archivesName_Id"/>

                    <div class="form-group">
                        <label class="control-label"><span class="asterisk">*</span>图片名称:</label>
                        <input id="input_name" name="picName" type="text" class="form-control" required>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="updateOtherNameSb"
                <%--data-action="{type:'submit',form:'#updateForm',url:'<%=request.getContextPath()%>/archives/test',after:'$.myAction.refreshContent'}"--%>>
                    确定
                </button>
            </div>
            <div id="J_progress_label" style="display: none;position: absolute;width: 200px;height: 60px;text-align: center;line-height: 60px;top: 0;left: 0;right: 0;bottom: 0;border-radius:15px;margin: auto;box-shadow:0px 0px 5px #e5f9f2;background:#f63;z-index:999;color:white;">

            </div>
        </div>
    </div>
</div>
<!-- 担保企业 -->
<div class="modal fade" id="companyAddModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="companyAddModalLabel">添加担保信息</h4>
            </div>
            <div class="modal-body">
                <form id="companyAddForm" enctype="multipart/form-data">
                    <div class="box box-danger">
                        <div class="box-header with-border">
                            <h3 class="box-title">企业</h3>
                        </div>
                        <div class="box-body panel">
                            <input type="hidden" id="compay_id" name="id" readonly required>
                            <input type="hidden" id="archives_id" name="archivesId" readonly required>

                            <div class="form-group">
                                <label for="input-id01" class="col-sm-6 control-label" id="input-idC1Label"><span
                                        class="asterisk">*</span>企业营业执照（副本）:</label>
                                <input id="input-id01" name="input-id01" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id2" class="col-sm-6 control-label" id="input-idC2Label"><span
                                        class="asterisk">*</span>开户许可证:</label>
                                <input id="input-id2" name="input-id2" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id3" class="col-sm-6 control-label" id="input-idC3Label"><span
                                        class="asterisk">*</span>机构信用代码证:</label>
                                <input id="input-id3" name="input-id3" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id4" class="col-sm-6 control-label" id="input-idC4Label"><span
                                        class="asterisk">*</span>法人身份证:</label>
                                <input id="input-id4" name="input-id4" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id5" class="col-sm-6 control-label" id="input-idC5Label">法人征信:</label>
                                <input id="input-id5" name="input-id5" type="file"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id6" class="col-sm-6 control-label" id="input-idC6Label"><span
                                        class="asterisk">*</span>企业征信:</label>
                                <input id="input-id6" name="input-id6" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id7" class="col-sm-6 control-label" id="input-idC7Label">验资报告:</label>
                                <input id="input-id7" name="input-id7" type="file"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id8" class="col-sm-6 control-label" id="input-idC8Label"><span
                                        class="asterisk">*</span>公司章程:</label>
                                <input id="input-id8" name="input-id8" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id9" class="col-sm-6 control-label" id="input-idC9Label"><span
                                        class="asterisk">*</span>年度报表:</label>
                                <input id="input-id9" name="input-id9" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id10" class="col-sm-6 control-label" id="input-idC10Label"><span
                                        class="asterisk">*</span>月度报表:</label>
                                <input id="input-id10" name="input-id10" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id11" class="col-sm-6 control-label" id="input-idC11Label">增值税纳税申报表:</label>
                                <input id="input-id11" name="input-id11" type="file"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id12" class="col-sm-6 control-label" id="input-idC12Label">法人夫妻双方的结婚证或户口本:</label>
                                <input id="input-id12" name="input-id12" type="file"
                                       data-show-caption="true" class="imagelimit">
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button"  class="btn btn-primary" id="submitAdd">
                            确定
                        </button>
                    </div>
                </form>
                <div id="J_progress_label" style="display: none;position: absolute;width: 200px;height: 60px;text-align: center;line-height: 60px;top: 0;left: 0;right: 0;bottom: 0;border-radius:15px;margin: auto;box-shadow:0px 0px 5px #e5f9f2;background:#f63;z-index:999;color:white;">

                </div>
            </div>

        </div>
    </div>
</div>
<!-- 担保个人 -->
<div class="modal fade" id="personalAddModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="addModalLabel">添加担保信息</h4>
            </div>
            <div class="modal-body">
                <form id="personalAddForm" enctype="multipart/form-data">
                    <div class="box box-danger">
                        <div class="box-header with-border">
                            <h3 class="box-title">个人</h3>
                        </div>
                        <div class="box-body panel">
                            <input type="hidden" id="compay_id" name="id" readonly required>
                            <input type="hidden" id="archives_id" name="archivesId" readonly required>

                            <div class="form-group">
                                <label for="input-id21" class="col-sm-6 control-label" id="input-idP1Label"><span
                                        class="asterisk">*</span>身份证复印件:</label>
                                <input id="input-id21" name="input-id21" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id22" class="col-sm-6 control-label" id="input-idP2Label"><span
                                        class="asterisk">*</span>户口本:</label>
                                <input id="input-id22" name="input-id22" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id23" class="col-sm-6 control-label" id="input-idP3Label"><span
                                        class="asterisk">*</span>收入证明:</label>
                                <input id="input-id23" name="input-id23" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id24" class="col-sm-6 control-label" id="input-idP4Label"><span
                                        class="asterisk">*</span>最新的个人征信:</label>
                                <input id="input-id24" name="input-id24" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>

                            <div class="form-group">
                                <label for="input-id25" class="col-sm-6 control-label" id="input-idP5Label"><span
                                        class="asterisk">*</span>结婚证或单身证明:</label>
                                <input id="input-id25" name="input-id25" type="file" required="required"
                                       data-show-caption="true" class="imagelimit">
                            </div>


                            <div class="form-group">
                                <label for="input-id26" class="col-sm-6 control-label"
                                       id="input-idP13Label">近半年银行卡流水清单:</label>
                                <input id="input-id26" name="input-id26" type="file" data-show-caption="true" class="imagelimit">
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button"  class="btn btn-primary" id="personalSubmitAdd">
                            确定
                        </button>
                    </div>
                </form>
                <div id="J_progress_label" style="display: none;position: absolute;width: 200px;height: 60px;text-align: center;line-height: 60px;top: 0;left: 0;right: 0;bottom: 0;border-radius:15px;margin: auto;box-shadow:0px 0px 5px #e5f9f2;background:#f63;z-index:999;color:white;">

                </div>
            </div>

        </div>
    </div>
</div>
<!-- 企业 核心企业 -->
<div class="modal fade" id="mainAddModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="archives_id">企业信息</h4>
            </div>
            <div class="modal-body">
                <form id="mainAddForm" enctype="multipart/form-data">
                    <div class="panel-body">
                        <input id="main_id" type="hidden" name="id">

                        <div class="form-group">
                            <label for="cominput-id1" class="col-sm-6 control-label" id="cominput-idC1Label"><span
                                    class="asterisk">*</span>企业营业执照（副本）:</label>
                            <input id="cominput-id1" name="cominput-id1" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id2" class="col-sm-6 control-label" id="cominput-idC2Label"><span
                                    class="asterisk">*</span>开户许可证:</label>
                            <input id="cominput-id2" name="cominput-id2" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id3" class="col-sm-6 control-label" id="cominput-idC3Label"><span
                                    class="asterisk">*</span>机构信用代码证:</label>
                            <input id="cominput-id3" name="cominput-id3" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id4" class="col-sm-6 control-label" id="cominput-idC4Label"><span
                                    class="asterisk">*</span>法人身份证:</label>
                            <input id="cominput-id4" name="cominput-id4" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id5" class="col-sm-6 control-label" id="cominput-idC5Label">法人征信:</label>
                            <input id="cominput-id5" name="cominput-id5" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id6" class="col-sm-6 control-label" id="cominput-idC6Label"><span
                                    class="asterisk">*</span>企业征信:</label>
                            <input id="cominput-id6" name="cominput-id6" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id7" class="col-sm-6 control-label" id="cominput-idC7Label">验资报告:</label>
                            <input id="cominput-id7" name="cominput-id7" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id8" class="col-sm-6 control-label" id="cominput-idC8Label"><span
                                    class="asterisk">*</span>公司章程:</label>
                            <input id="cominput-id8" name="cominput-id8" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id9" class="col-sm-6 control-label" id="cominput-idC9Label"><span
                                    class="asterisk">*</span>年度报表:</label>
                            <input id="cominput-id9" name="cominput-id9" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id10" class="col-sm-6 control-label" id="cominput-idC10Label"><span
                                    class="asterisk">*</span>月度报表:</label>
                            <input id="cominput-id10" name="cominput-id10" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id11" class="col-sm-6 control-label" id="cominput-idC11Label">增值税纳税申报表:</label>
                            <input id="cominput-id11" name="cominput-id11" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id12" class="col-sm-6 control-label" id="cominput-idC12Label"><span
                                    class="asterisk">*</span>销售合同:</label>
                            <input id="cominput-id12" name="cominput-id12" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id14" class="col-sm-6 control-label" id="cominput-idC14Label"><span
                                    class="asterisk">*</span>采购合同:</label>
                            <input id="cominput-id14" name="cominput-id14" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id13" class="col-sm-6 control-label" id="cominput-idC13Label"><span
                                    class="asterisk">*</span>法人夫妻双方的结婚证或户口本:</label>
                            <input id="cominput-id13" name="cominput-id13" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id15" class="col-sm-6 control-label" id="cominput-idC15Label">电费发票:</label>
                            <input id="cominput-id15" name="cominput-id15" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id16" class="col-sm-6 control-label" id="cominput-idC16Label">环评报告:</label>
                            <input id="cominput-id16" name="cominput-id16" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id17" class="col-sm-6 control-label" id="cominput-idC17Label">银行流水:</label>
                            <input id="cominput-id17" name="cominput-id17" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>


                        <div class="form-group">
                            <label for="input-id18" class="col-sm-6 control-label"
                                   id="input-idC18Label">从事特种行业的相关资质材料:</label>
                            <input id="input-id18" name="input-id18" type="file" data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="cominput-id19" class="col-sm-6 control-label"
                                   id="cominput-idC19Label">企业不动产证:</label>
                            <input id="cominput-id19" name="cominput-id19" type="file" data-show-caption="true" class="imagelimit">
                        </div>


                        <div class="form-group">
                            <label for="cominput-id20" class="col-sm-6 control-label" id="cominput-idC20Label">担保措施为抵质押物的需提供抵质押物明细及相关材料:</label>
                            <input id="cominput-id20" name="cominput-id20" type="file" data-show-caption="true" class="imagelimit">
                        </div>
                    </div>
                    <div class="box-footer">
                        <button type="button" class="btn btn-info pull-right" id="mainSubmitImgAdd">图片上传</button>
                    </div>
                </form>
                <div id="J_progress_label" style="display: none;position: absolute;width: 200px;height: 60px;text-align: center;line-height: 60px;top: 0;left: 0;right: 0;bottom: 0;border-radius:15px;margin: auto;box-shadow:0px 0px 5px #e5f9f2;background:#f63;z-index:999;color:white;">

                </div>
            </div>

        </div>
    </div>
</div>

<!-- 企业 一般企业 -->
<div class="modal fade" id="commonAddModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="archives_id">企业信息</h4>
            </div>
            <div class="modal-body">
                <form id="commonAddForm" name="imgForm" enctype="multipart/form-data">
                    <div class="panel-body">
                        <input id="common_id" type="hidden" name="id">

                        <div class="form-group">
                            <label for="commoninput-id1" class="col-sm-6 control-label" id="commoninput-idC1Label"><span
                                    class="asterisk">*</span>企业营业执照（副本）:</label>
                            <input id="commoninput-id1" name="commoninput-id1" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id2" class="col-sm-6 control-label" id="commoninput-idC2Label"><span
                                    class="asterisk">*</span>开户许可证:</label>
                            <input id="commoninput-id2" name="commoninput-id2" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id3" class="col-sm-6 control-label" id="commoninput-idC3Label"><span
                                    class="asterisk">*</span>机构信用代码证:</label>
                            <input id="commoninput-id3" name="commoninput-id3" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id4" class="col-sm-6 control-label" id="commoninput-idC4Label"><span
                                    class="asterisk">*</span>法人身份证:</label>
                            <input id="commoninput-id4" name="commoninput-id4" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id5" class="col-sm-6 control-label" id="commoninput-idC5Label">法人征信:</label>
                            <input id="commoninput-id5" name="commoninput-id5" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id6" class="col-sm-6 control-label" id="commoninput-idC6Label"><span
                                    class="asterisk">*</span>企业征信:</label>
                            <input id="commoninput-id6" name="commoninput-id6" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id7" class="col-sm-6 control-label" id="commoninput-idC7Label">验资报告:</label>
                            <input id="commoninput-id7" name="commoninput-id7" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id8" class="col-sm-6 control-label" id="commoninput-idC8Label"><span
                                    class="asterisk">*</span>公司章程:</label>
                            <input id="commoninput-id8" name="input-id8" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id9" class="col-sm-6 control-label" id="commoninput-idC9Label"><span
                                    class="asterisk">*</span>年度报表:</label>
                            <input id="commoninput-id9" name="input-id9" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id10" class="col-sm-6 control-label"
                                   id="commoninput-idC10Label"><span
                                    class="asterisk">*</span>月度报表:</label>
                            <input id="commoninput-id10" name="commoninput-id10" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id11" class="col-sm-6 control-label"
                                   id="commoninput-idC11Label">增值税纳税申报表:</label>
                            <input id="commoninput-id11" name="commoninput-id11" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id12" class="col-sm-6 control-label"
                                   id="commoninput-idC12Label"><span
                                    class="asterisk">*</span>销售合同:</label>
                            <input id="commoninput-id12" name="commoninput-id12" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id13" class="col-sm-6 control-label"
                                   id="commoninput-idC13Label"><span
                                    class="asterisk">*</span>法人夫妻双方的结婚证或户口本:</label>
                            <input id="commoninput-id13" name="commoninput-id13" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id15" class="col-sm-6 control-label"
                                   id="commoninput-idC15Label">电费发票:</label>
                            <input id="commoninput-id15" name="commoninput-id15" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id16" class="col-sm-6 control-label"
                                   id="commoninput-idC16Label">环评报告:</label>
                            <input id="commoninput-id16" name="commoninput-id16" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id17" class="col-sm-6 control-label"
                                   id="commoninput-idC17Label">银行流水:</label>
                            <input id="commoninput-id17" name="commoninput-id17" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>


                        <div class="form-group">
                            <label for="commoninput-id18" class="col-sm-6 control-label" id="commoninput-idC18Label">从事特种行业的相关资质材料:</label>
                            <input id="commoninput-id18" name="commoninput-id18" type="file" data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="commoninput-id19" class="col-sm-6 control-label"
                                   id="commoninput-idC19Label">企业不动产证:</label>
                            <input id="commoninput-id19" name="commoninput-id19" type="file" data-show-caption="true" class="imagelimit">
                        </div>
                    </div>
                    <div class="box-footer">
                        <button type="button" class="btn btn-info pull-right" id="commonSubmitImgAdd">图片上传</button>
                    </div>
                </form>
                <div id="J_progress_label" style="display: none;position: absolute;width: 200px;height: 60px;text-align: center;line-height: 60px;top: 0;left: 0;right: 0;bottom: 0;border-radius:15px;margin: auto;box-shadow:0px 0px 5px #e5f9f2;background:#f63;z-index:999;color:white;">

                </div>
            </div>

        </div>
    </div>
</div>

<!-- 企业 个人 -->
<div class="modal fade" id="pcomAddModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="archives_id">企业信息</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" id="pcomAddForm" enctype="multipart/form-data">
                    <div class="panel-body">
                        <input id="pcom_id" type="hidden" name="id">

                        <div class="form-group">
                            <label for="pcominput-id1" class="col-sm-6 control-label" id="pcominput-idP1Label"><span
                                    class="asterisk">*</span>借款人身份证:</label>
                            <input id="pcominput-id1" name="pcominput-id1" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="pcominput-id2" class="col-sm-6 control-label" id="pcominput-idP2Label"><span
                                    class="asterisk">*</span>户口本:</label>
                            <input id="pcominput-id2" name="input-id2" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="pcominput-id3" class="col-sm-6 control-label" id="pcominput-idP3Label">结婚证:</label>
                            <input id="pcominput-id3" name="pcominput-id3" type="file"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="pcominput-id4" class="col-sm-6 control-label" id="pcominput-idP4Label"><span
                                    class="asterisk">*</span>个人最新人行征信:</label>
                            <input id="pcominput-id4" name="pcominput-id4" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="pcominput-id5" class="col-sm-6 control-label" id="pcominput-idP5Label"><span
                                    class="asterisk">*</span>有效的收入证明:</label>
                            <input id="pcominput-id5" name="pcominput-id5" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="pcominput-id6" class="col-sm-6 control-label" id="pcominput-idP6Label"><span
                                    class="asterisk">*</span>个人消费有关证明材料:</label>
                            <input id="pcominput-id6" name="pcominput-id6" type="file" required="required"
                                   data-show-caption="true" class="imagelimit">
                        </div>


                        <div class="form-group">
                            <label for="pcominput-id18" class="col-sm-6 control-label"
                                   id="pcominput-idP18Label">个人资产证明:</label>
                            <input id="pcominput-id18" name="pcominput-id18" type="file" data-show-caption="true" class="imagelimit">
                        </div>

                        <div class="form-group">
                            <label for="pcominput-id19" class="col-sm-6 control-label"
                                   id="pcominput-idP19Label">个人银行卡流水:</label>
                            <input id="pcominput-id19" name="pcominput-id19" type="file" data-show-caption="true" class="imagelimit">
                        </div>


                        <div class="form-group">
                            <label for="pcominput-id20" class="col-sm-6 control-label"
                                   id="pcominput-idP20Label">借款后资金用途证明:</label>
                            <input id="pcominput-id20" name="pcominput-id20" type="file" data-show-caption="true" class="imagelimit">
                        </div>
                    </div>
                    <div class="box-footer">
                        <button type="button" class="btn btn-info pull-right" id="pcomSubmitImgAdd">图片上传</button>
                    </div>
                </form>
                <div id="J_progress_label" style="display: none;position: absolute;width: 200px;height: 60px;text-align: center;line-height: 60px;top: 0;left: 0;right: 0;bottom: 0;border-radius:15px;margin: auto;box-shadow:0px 0px 5px #e5f9f2;background:#f63;z-index:999;color:white;">

                </div>
            </div>

        </div>
    </div>
</div>


<script>


    //图片信息保存
    $("#submitImgAdd").click(function () {
        $("#submitImgAdd").attr("disabled", "disabled");
        var id = $("#id").val();
        var ids=$("#company_archives_id").val();
        var formData = new FormData();
        var strParms = "id=" + id;
        var sizeTotal=0;
        var flag=true;
        var sizeflag = true;
        $("#newAddForm :input").each(function () {
            var type = $(this).attr("type");
            if (type == "file") {
                var name = $(this).attr("id");
                var label_name = "";
                var filename = $(this)[0].files[0];
                $('label[for="' + name + '"]').each(function () {
                    label_name = $(this).text();
                });
                if (label_name == null || label_name == "") {
                    flag = false;
                }
                formData.append(label_name, filename);
                sizeTotal=sizeTotal+filename.size;
            }
        });

        if(sizeTotal>200*1024*1024){
            sizeflag=false;
            alert("文件需小于200M");
            $("#submitImgAdd").removeAttr("disabled");
            return;
        }
        if(sizeflag && flag) {
            var that = this;
            var loadnum = 0;
            var oldloaded = 0;
            $.ajax({
                type: 'post',
                url: '/company/saveCompanyUploadInfo?' + strParms,
                cache: false,
                data: formData,
                contentType: false,
                processData: false,
                xhr: function () {
                    myXhr = $.ajaxSettings.xhr();
                    if (myXhr.upload) {
                        $(that).parents('.modal ').find('#J_progress_label').show();
                        myXhr.upload.addEventListener('progress', function (e) {
                            if (e.lengthComputable) {
                                if (e.loaded != 0) {
                                    loadnum += Math.abs(e.loaded - oldloaded);
                                    console.log(e.loaded, loadnum, e.total);
                                    oldloaded = e.loaded;
                                } else {
                                    oldloaded = 0;
                                }

                                var percent = Math.floor(loadnum / e.total * 100);
                                if (percent <= 100) {
                                    $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                }
                                if (percent >= 100) {
                                    $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                }
                            }
                        }, false);
                    }
                    return myXhr;
                },
                success: function (data) {
                    alert('上传图片成功');
                    loadHref('#archives/detail?id=' + ids + '');
                },
                error: function () {
                    alert("上传图片失败");
                    $("#submitImgAdd").removeAttr("disabled");
                }
            })
        }else if (!flag) {
            $(".submitImgAdd").removeAttr("disabled");
            alert("标题不能为空");
        }
    })


    //图片信息保存
    $(".tubtn").click(function () {
        $(".tubtn").attr("disabled", "disabled");
        var ids = $("#company_archives_id").val();
        var id = $(this).parents('.panel ').find("#idGuarantees").val();
        var formData = new FormData();
        var strParms = "id=" + id;
        var sizeTotal=0;
        var flag=true;
        var sizeFlag=true;
        $(this).parents('.panel ').find("#newGuaranteesAddForm :input").each(function () {
            var type = $(this).attr("type");
            if (type == "file") {
                var name = $(this).attr("id");
                var label_name = "";
                var filename = $(this)[0].files[0];
                $('label[for="' + name + '"]').each(function () {
                    label_name = $(this).text();
                });
                if (label_name == null || label_name == "") {
                    flag = false;
                }
                formData.append(label_name, filename);

                sizeTotal=sizeTotal+filename.size;
            }
        });

        if(sizeTotal>200*1024*1024){
            sizeFlag=false;
            alert("文件需小于200M");
            $(".tubtn").removeAttr("disabled");
            return;
        }
        if(sizeFlag&&flag) {
            var that = this;
            var loadnum = 0;
            var oldloaded = 0;
            $.ajax({
                type: 'post',
                url: '/company/saveCompanyUploadInfo?' + strParms,
                cache: false,
                data: formData,
                contentType: false,
                processData: false,
                xhr: function () {
                    myXhr = $.ajaxSettings.xhr();
                    if (myXhr.upload) {
                        $(that).parents('.modal ').find('#J_progress_label').show();
                        myXhr.upload.addEventListener('progress', function (e) {
                            if (e.lengthComputable) {
                                if (e.loaded != 0) {
                                    loadnum += Math.abs(e.loaded - oldloaded);
                                    console.log(e.loaded, loadnum, e.total);
                                    oldloaded = e.loaded;
                                } else {
                                    oldloaded = 0;
                                }

                                var percent = Math.floor(loadnum / e.total * 100);

                                if (percent <= 100) {
                                    $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                }
                                if (percent >= 100) {
                                    $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                }
                            }
                        }, false);
                    }
                    return myXhr;
                },
                success: function (data) {
                    alert('上传图片成功');
                    loadHref('#archives/detail?id=' + ids + '');
                },
                error: function () {
                    alert("上传图片失败");
                    $(".tubtn").removeAttr("disabled");
                }
            })
        }else if (!flag) {
            $(".tubtn").removeAttr("disabled");
            alert("标题不能为空");
        }
    })


    $(function () {
        var inputidnum = 31;
        $('.panel').on('click', '.ht_in_jia', function () {
            inputidnum++;
            var thisid = "input-id" + inputidnum;
            var thisidLabel = "input-id" + inputidnum + "Label";

            $('.panel').on('input propertychange', '.inputtitle', function () {
                $(this).parent().next('label').html('用户新增' + $(this).val());
            });


            $(this).parents('.form-group').append('<div class="form-group">' +
            '<span class="formspan col-sm-6">标题：<input type="text" name="" class="inputtitle"/></span><label for="' + thisid + '" class="col-sm-6 control-label" style="display: none;" id="' + thisidLabel + '"></label>' +
            '<input id="' + thisid + '" name="' + thisid + '" type="file" required="required" data-show-caption="true" class="imagelimit">' +
            '<input type="button" value="-" class="ht_in_jian">' +
            '</div>');

            $(this).parents('.form-group').siblings(".box-footer").attr("style", "display:block");


        });
        $('.panel').on('click', '.ht_in_jian', function () {
            if ($($(this).parents('.form-group')[1]).find('.form-group').length == 1) {
                $($(this).parents('.form-group')[1]).siblings(".box-footer").attr("style", "display:none");
            }
            $(this).parents('.form-group')[0].remove();
        });
    })


    function loadHref(s) {
        $.myAdmin.loadContent(s);
    }
    //更新证件图片
    function updateImage(uploadId) {
        $('#updateModal').modal('show')
        $('#upload_id').val(uploadId)
    }

    //更新其他证件名称
    function updateOtherName(uploadId, archivesId) {
        $('#updateOtherNameModal').modal('show')
        $("#input_name").removeAttr("readonly")
        $('#uploadName_id').val(uploadId)
        $('#archivesName_Id').val(archivesId)
    }

    //担保详情修改
    function editDetail(btn) {
        saveDetail_ID = "saveDetail_ID" + btn;
        editDetail_ID = "editDetail_ID" + btn;
        detailG = "detailG" + btn;
        $("#" + detailG).find("input").removeAttr("readonly")
        $("#" + saveDetail_ID).show();
        $("#" + editDetail_ID).hide();
    }
    //担保详情保存
    function saveDetail(btn, archivesId) {
        var ids=$("#company_archives_id").val();
        detailG = "detailG" + btn;
        $.ajax({
            type: "post",
            url: '/company/editCompanyInfo',
            data: $('#' + detailG).serialize(),
            success: function (data) {
                $.myNotify.success(data.msg);
                loadHref('#archives/detail?id=' + ids + '')
            },
            error: function (data) {
                $.myNotify.danger(data.msg);
            }
        })
    }

    <!-- ----------------------------担保图片------------------------------------------------------- -->
    //担保 企业添加照片
    function companyAddImage(guaranteesId, archivesId) {
        $('#companyAddModal').modal('show');
        $('#compay_id').val(guaranteesId)
        $('#archives_id').val(archivesId)
    }
    // 担保个人添加照片
    function personalAddImage(guaranteesId, archivesId) {
        $('#personalAddModal').modal('show');
        $('#compay_id').val(guaranteesId)
        $('#archives_id').val(archivesId)
    }

    //担保 企业添加照片
    $("#submitAdd").click(function () {
        var id = $("#compay_id").val();
        var ids=$("#company_archives_id").val();
        var archivesId = $("#archives_id").val();
        var sizeTotal=0;
        var sizeFlag=true;
        if (checkImageInput()) {
            $("#submitAdd").attr("disabled", "disabled");
            var formData = new FormData();
            var strParms = "id=" + id;
            $("#companyAddForm :input").each(function () {
                var type = $(this).attr("type");
                if (type == "file" && $(this).attr("style") != "display:none") {
                    var name = $(this).attr("id");
                    var label_name = "";
                    var filename = $(this)[0].files[0];
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            label_name = $(this).text();
                        }
                    });

                    if (filename == null) {
                        strParms = strParms + "&" + encodeURI(encodeURI(label_name)) + "=";
                    } else {
                        formData.append(label_name, filename);
                        sizeTotal=sizeTotal+filename.size;
                    }

                }
            });

            if(sizeTotal>200*1024*1024){
                sizeFlag=false;
                alert("文件需小于200M");
                $("#submitAdd").removeAttr("disabled");
                return;
            }
            if(sizeFlag) {
                var that = this;
                var loadnum = 0;
                var oldloaded = 0;
                $.ajax({
                    type: 'post',
                    url: '/company/saveCompanyUploadInfo?' + strParms,
                    cache: false,
                    data: formData,
                    contentType: false,
                    processData: false,
                    xhr: function () {
                        myXhr = $.ajaxSettings.xhr();
                        if (myXhr.upload) {
                            $(that).parents('.modal ').find('#J_progress_label').show();
                            myXhr.upload.addEventListener('progress', function (e) {
                                if (e.lengthComputable) {
                                    if (e.loaded != 0) {
                                        loadnum += Math.abs(e.loaded - oldloaded);
                                        console.log(e.loaded, loadnum, e.total);
                                        oldloaded = e.loaded;
                                    } else {
                                        oldloaded = 0;
                                    }

                                    var percent = Math.floor(loadnum / e.total * 100);
                                    if (percent <= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                    }
                                    if (percent >= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                    }
                                }
                            }, false);
                        }
                        return myXhr;
                    },
                    success: function (data) {
                        alert('上传图片成功');
                        $('#companyAddModal').modal('hide');
                        loadHref('#archives/detail?id=' + ids + '');
                    },
                    error: function () {
                        alert("上传图片失败");
                        $("#submitAdd").removeAttr("disabled");
                    }
                })
            }
        }else{
            return;
        }
    })
    //图片非空校验
    function checkImageInput() {
        var checkFlag = true;
        $("#companyAddForm :input").each(function () {
            var type = $(this).attr("type");
            if (type == "file" && $(this).attr("style") != "display:none" && $(this).attr("required") == "required") {
                var name = $(this).attr("id");
                if ($(this).val() == "") {
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            alert($(this).text() + "不能为空");
                            checkFlag = false;
                        }
                    });
                }
                return checkFlag;
            }
        });
        return checkFlag;
    }
    // 担保个人添加照片
    $("#personalSubmitAdd").click(function () {
        var id = $("#compay_id").val();
        var ids=$("#company_archives_id").val();
        var sizeTotal=0;
        var sizeFlag=true;
        var archivesId = $("#archives_id").val();
        if (perCheckImageInput()) {
            $("#personalSubmitAdd").attr("disabled", "disabled");
            //console.log("aaaa");
            var formData = new FormData();
            var strParms = "id=" + id;
            $("#personalAddForm :input").each(function () {
                var type = $(this).attr("type");
                if (type == "file" && $(this).attr("style") != "display:none") {
                    var name = $(this).attr("id");
                    var label_name = "";
                    var filename = $(this)[0].files[0];
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            label_name = $(this).text();
                        }
                    });

                    if (filename == null) {
                        strParms = strParms + "&" + encodeURI(encodeURI(label_name)) + "=";
                    } else {
                        formData.append(label_name, filename);
                        sizeTotal=sizeTotal+filename.size;
                    }

                }
            });

            if(sizeTotal>200*1024*1024){
                sizeFlag=false;
                alert("文件需小于200M");
                $("#personalSubmitAdd").removeAttr("disabled");
                return;
            }
            if(sizeFlag) {
                var that = this;
                var loadnum = 0;
                var oldloaded = 0;
                $.ajax({
                    type: 'post',
                    url: '/company/saveCompanyUploadInfo?' + strParms,
                    cache: false,
                    data: formData,
                    contentType: false,
                    processData: false,
                    xhr: function () {
                        myXhr = $.ajaxSettings.xhr();
                        if (myXhr.upload) {
                            $(that).parents('.modal ').find('#J_progress_label').show();
                            myXhr.upload.addEventListener('progress', function (e) {
                                if (e.lengthComputable) {
                                    if (e.loaded != 0) {
                                        loadnum += Math.abs(e.loaded - oldloaded);
                                        console.log(e.loaded, loadnum, e.total);
                                        oldloaded = e.loaded;
                                    } else {
                                        oldloaded = 0;
                                    }

                                    var percent = Math.floor(loadnum / e.total * 100);

                                    if (percent <= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                    }
                                    if (percent >= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                    }
                                }
                            }, false);
                        }
                        return myXhr;
                    },
                    success: function (data) {
                        alert('上传图片成功');
                        $('#personalAddModal').modal('hide');
                        loadHref(loadHref('#archives/detail?id=' + ids + ''));
                    },
                    error: function () {
                        alert("上传图片失败");
                        $("#personalSubmitImgAdd").removeAttr("disabled");

                    }
                })
            }
        }
    })
    //图片非空校验
    function perCheckImageInput() {
        var checkFlag = true;
        $("#personalAddForm :input").each(function () {
            var type = $(this).attr("type");
            if (type == "file" && $(this).attr("style") != "display:none" && $(this).attr("required") == "required") {
                var name = $(this).attr("id");
                if ($(this).val() == "") {
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            alert($(this).text() + "不能为空");
                            checkFlag = false;
                        }
                    });
                }
                return checkFlag;
            }
        });
        return checkFlag;
    }

    <!-- ----------------------------企业图片------------------------------------------------------- -->
    // 企业 核心企业添加照片
    function mainAddImage(archivesId) {
        $('#mainAddModal').modal('show');
        $('#archives_id').val(archivesId)
    }
    // 企业 一般企业添加照片
    function commonAddImage(archivesId) {
        $('#commonAddModal').modal('show');
        $('#archives_id').val(archivesId)
    }
    // 企业 个人添加照片
    function pcomAddImage(archivesId) {
        $('#pcomAddModal').modal('show');
        $('#archives_id').val(archivesId)
    }

    //企业 核心企业添加照片
    $("#mainSubmitImgAdd").click(function () {
        //var id = $("#compay_id").val();
        var ids=$("#company_archives_id").val();
        var archivesId = $("#archives_id").val();
        var sizeTotal=0;
        var sizeFlag=true;
        if (mainCheckImageInput()) {
            $("#mainSubmitImgAdd").attr("disabled", "disabled");
            var formData = new FormData();
            var strParms = "id=" + archivesId;
            $("#mainAddForm :input").each(function () {
                var type = $(this).attr("type");
                if (type == "file" && $(this).attr("style") != "display:none") {
                    var name = $(this).attr("id");
                    var label_name = "";
                    var filename = $(this)[0].files[0];
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            label_name = $(this).text();
                        }
                    });

                    if (filename == null) {
                        strParms = strParms + "&" + encodeURI(encodeURI(label_name)) + "=";
                    } else {
                        formData.append(label_name, filename);
                        sizeTotal=sizeTotal+filename.size;
                    }

                }
            });

            if(sizeTotal>200*1024*1024){
                sizeFlag=false;
                alert("文件需小于200M");
                $("#mainSubmitImgAdd").removeAttr("disabled");
                return;
            }
            if(sizeFlag) {
                var that = this;
                var loadnum = 0;
                var oldloaded = 0;
                $.ajax({
                    type: 'post',
                    url: '/company/saveCompanyUploadInfo?' + strParms,
                    cache: false,
                    data: formData,
                    contentType: false,
                    processData: false,
                    xhr: function () {
                        myXhr = $.ajaxSettings.xhr();
                        if (myXhr.upload) {
                            $(that).parents('.modal ').find('#J_progress_label').show();
                            myXhr.upload.addEventListener('progress', function (e) {
                                if (e.lengthComputable) {
                                    if (e.loaded != 0) {
                                        loadnum += Math.abs(e.loaded - oldloaded);
                                        console.log(e.loaded, loadnum, e.total);
                                        oldloaded = e.loaded;
                                    } else {
                                        oldloaded = 0;
                                    }

                                    var percent = Math.floor(loadnum / e.total * 100);

                                    if (percent <= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                    }
                                    if (percent >= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                    }
                                }
                            }, false);
                        }
                        return myXhr;
                    },
                    success: function (data) {
                        alert('上传图片成功');
                        $('#mainAddModal').modal('hide');
                        loadHref(loadHref('#archives/detail?id=' + ids + ''));
                    },
                    error: function () {
                        alert("上传图片失败");
                        $("#mainSubmitImgAdd").removeAttr("disabled");
                    }
                })
            }
        }
    })
    //图片非空校验
    function mainCheckImageInput() {
        var checkFlag = true;
        $("#mainAddForm :input").each(function () {
            var type = $(this).attr("type");
            if (type == "file" && $(this).attr("style") != "display:none" && $(this).attr("required") == "required") {
                var name = $(this).attr("id");
                if ($(this).val() == "") {
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            alert($(this).text() + "不能为空");
                            checkFlag = false;
                        }
                    });
                }
                return checkFlag;
            }
        });
        return checkFlag;
    }

    //企业 一般企业添加照片
    $("#commonSubmitImgAdd").click(function () {
        // var id = $("#compay_id").val();
        var ids=$("#company_archives_id").val();
        var archivesId = $("#archives_id").val();
        var sizeTotal=0;
        var sizeFlag=true;
        if (commonCheckImageInput()) {
            $("#commonSubmitImgAdd").attr("disabled", "disabled");

            var formData = new FormData();
            var strParms = "id=" + archivesId;
            $("#commonAddForm :input").each(function () {
                var type = $(this).attr("type");
                if (type == "file" && $(this).attr("style") != "display:none") {
                    var name = $(this).attr("id");
                    var label_name = "";
                    var filename = $(this)[0].files[0];
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            label_name = $(this).text();
                        }
                    });

                    if (filename == null) {
                        strParms = strParms + "&" + encodeURI(encodeURI(label_name)) + "=";
                    } else {
                        formData.append(label_name, filename);
                        sizeTotal=sizeTotal+filename.size;
                    }

                }
            });
            if(sizeTotal>200*1024*1024){
                sizeFlag=false;
                alert("文件需小于200M");
                $("#commonSubmitImgAdd").removeAttr("disabled");
                return;
            }
            if(sizeFlag) {
                var that = this;
                var loadnum = 0;
                var oldloaded = 0;
                $.ajax({
                    type: 'post',
                    url: '/company/saveCompanyUploadInfo?' + strParms,
                    cache: false,
                    data: formData,
                    contentType: false,
                    processData: false,
                    xhr: function () {
                        myXhr = $.ajaxSettings.xhr();
                        if (myXhr.upload) {
                            $(that).parents('.modal ').find('#J_progress_label').show();
                            myXhr.upload.addEventListener('progress', function (e) {
                                if (e.lengthComputable) {
                                    if (e.loaded != 0) {
                                        loadnum += Math.abs(e.loaded - oldloaded);
                                        console.log(e.loaded, loadnum, e.total);
                                        oldloaded = e.loaded;
                                    } else {
                                        oldloaded = 0;
                                    }

                                    var percent = Math.floor(loadnum / e.total * 100);

                                    if (percent <= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                    }
                                    if (percent >= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                    }
                                }
                            }, false);
                        }
                        return myXhr;
                    },
                    success: function (data) {
                        alert('上传图片成功');
                        $('#commonAddModal').modal('hide');
                        loadHref(loadHref('#archives/detail?id=' + ids + ''));
                    },
                    error: function () {
                        alert("上传图片失败");
                        $("#commonSubmitImgAdd").removeAttr("disabled");

                    }
                })
            }
        }
    })
    //图片非空校验
    function commonCheckImageInput() {
        var checkFlag = true;
        $("#commonAddForm :input").each(function () {
            var type = $(this).attr("type");
            if (type == "file" && $(this).attr("style") != "display:none" && $(this).attr("required") == "required") {
                var name = $(this).attr("id");
                if ($(this).val() == "") {
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            alert($(this).text() + "不能为空");
                            checkFlag = false;
                        }
                    });
                }
                return checkFlag;
            }
        });
        return checkFlag;
    }

    //企业 个人添加照片
    $("#pcomSubmitImgAdd").click(function () {
        //var id = $("#compay_id").val();
        var archivesId = $("#archives_id").val();
        var ids=$("#company_archives_id").val();
        var sizeTotal=0;
        var sizeFlag=true;
        if (pcomCheckImageInput()) {
            $("#pcomSubmitImgAdd").attr("disabled", "disabled");
            var formData = new FormData();
            var strParms = "id=" + archivesId;
            $("#pcomAddForm :input").each(function () {
                var type = $(this).attr("type");
                if (type == "file" && $(this).attr("style") != "display:none") {
                    var name = $(this).attr("id");
                    var label_name = "";
                    var filename = $(this)[0].files[0];
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            label_name = $(this).text();
                        }
                    });

                    if (filename == null) {
                        strParms = strParms + "&" + encodeURI(encodeURI(label_name)) + "=";
                    } else {
                        formData.append(label_name, filename);
                        sizeTotal=sizeTotal+filename.size;
                    }

                }
            });
            if(sizeTotal>200*1024*1024){
                sizeFlag=false;
                alert("文件需小于200M");
                $("#pcomSubmitImgAdd").removeAttr("disabled");
                return;
            }
            if(sizeFlag) {
                var that = this;
                var loadnum = 0;
                var oldloaded = 0;
                $.ajax({
                    type: 'post',
                    url: '/company/saveCompanyUploadInfo?' + strParms,
                    cache: false,
                    data: formData,
                    contentType: false,
                    processData: false,
                    xhr: function () {
                        myXhr = $.ajaxSettings.xhr();
                        if (myXhr.upload) {
                            $(that).parents('.modal ').find('#J_progress_label').show();
                            myXhr.upload.addEventListener('progress', function (e) {
                                if (e.lengthComputable) {
                                    if (e.loaded != 0) {
                                        loadnum += Math.abs(e.loaded - oldloaded);
                                        console.log(e.loaded, loadnum, e.total);
                                        oldloaded = e.loaded;
                                    } else {
                                        oldloaded = 0;
                                    }

                                    var percent = Math.floor(loadnum / e.total * 100);

                                    if (percent <= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                    }
                                    if (percent >= 100) {
                                        $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                    }
                                }
                            }, false);
                        }
                        return myXhr;
                    },
                    success: function (data) {
                        alert('上传图片成功');
                        $('#pcomAddModal').modal('hide');
                        loadHref(loadHref('#archives/detail?id=' + ids + ''));
                    },
                    error: function () {
                        alert("上传图片失败");
                        $("#pcomSubmitImgAdd").removeAttr("disabled");

                    }
                })
            }
        }
    })
    //图片非空校验
    function pcomCheckImageInput() {
        var checkFlag = true;
        $("#pcomAddForm :input").each(function () {
            var type = $(this).attr("type");
            if (type == "file" && $(this).attr("style") != "display:none" && $(this).attr("required") == "required") {
                var name = $(this).attr("id");
                if ($(this).val() == "") {
                    $('label[for="' + name + '"]').each(function () {
                        if ($(this).attr("style") != "display:none") {
                            alert($(this).text() + "不能为空");
                            checkFlag = false;
                        }
                    });
                }
                return checkFlag;
            }
        });
        return checkFlag;
    }

    <!-- ----------------------------------------------------------------------------------- -->


    $("#updateImage").click(function () {
        var archivesId = $("#company_archives_id").val();
        var formData = new FormData();
        var sizeTotal=0;
        var sizeFlag=true;
        var ids=$("#company_archives_id").val();
        $("#updateImage").attr("disabled", "disabled");

        $("#updateForm :input").each(function () {

            var type = $(this).attr("type");
            var name = $(this).attr("id");
            if (type == "file") {
                formData.append(name, $(this)[0].files[0]);
                sizeTotal=sizeTotal+ $(this)[0].files[0].size;
            }
        });

        if(sizeTotal>200*1024*1024){
            sizeFlag=false;
            alert("文件需小于200M");
            $("#updateImage").removeAttr("disabled");
            return;
        }
        if(sizeFlag) {
            var that = this;
            var loadnum = 0;
            var oldloaded = 0;
            $.ajax({
                type: 'post',
                url: '/company/editCompanyUploadInfo?' + $('#updateForm').serialize(),
                cache: false,
                data: formData,
                contentType: false,
                processData: false,
                xhr: function () {
                    myXhr = $.ajaxSettings.xhr();
                    if (myXhr.upload) {
                        $(that).parents('.modal ').find('#J_progress_label').show();
                        myXhr.upload.addEventListener('progress', function (e) {
                            if (e.lengthComputable) {
                                if (e.loaded != 0) {
                                    loadnum += Math.abs(e.loaded - oldloaded);
                                    console.log(e.loaded, loadnum, e.total);
                                    oldloaded = e.loaded;
                                } else {
                                    oldloaded = 0;
                                }

                                var percent = Math.floor(loadnum / e.total * 100);

                                if (percent <= 100) {
                                    $(that).parents('.modal ').find("#J_progress_label").html('已上传：' + percent + '%');
                                }
                                if (percent >= 100) {
                                    $(that).parents('.modal ').find("#J_progress_label").html('文件上传完毕，请等待处理...');
                                }
                            }
                        }, false);
                    }
                    return myXhr;
                },
                success: function (data) {
                    alert('更新图片成功');
                    $("#updateModal").modal('hide');
                    //$.myAction.refreshContent();
                    loadHref('#archives/detail?id=' + ids + '');
                },
                error: function () {
                    alert("上传图片失败");
                    $("#updateImage").removeAttr("disabled");

                }
            })
        }
    })

    $("#updateOtherNameSb").click(function () {
        archivesId = $('#archivesName_Id').val();
        var ids=$("#company_archives_id").val();
        $.ajax({
            type: 'post',
            url: '/company/updateCompanyUploadInfo',
            cache: false,
            data: $('#updateOtherNameForm').serialize(),
            processData: false,
            success: function (data) {
                alert('更新成功');
                $("#updateOtherNameSb").attr("disabled", "disabled");
                $("#updateOtherNameModal").modal('hide');
                loadHref('#archives/detail?id=' + ids + '')
            },
            error: function () {
                alert("更新失败");
            }
        })

    })


    $(function () {
        $("#saveCompany_ID").hide();
        $(".btn-success").hide();
        $('input').attr("readonly", "readonly")
        $('#creditLimit_select').attr("disabled", "disabled")

        //企业修改按钮
        $("#editCompany_ID").click(function () {
            $("#detailCompany").find("input").removeAttr("readonly")
            $("#creditLimit_select").removeAttr("disabled")
            $("#saveCompany_ID").show();
            $("#editCompany_ID").hide();
        })

        //企业保存按钮
        $("#saveCompany_ID").click(function () {
            var ids=$("#company_archives_id").val();
            archivesId = $("#company_archives_id").val();
            $.ajax({
                type: "post",
                url: '/company/editCompanyInfo',
                data: $('#detailCompany').serialize(),
                success: function (data) {
                    $.myNotify.success(data.msg);
                    loadHref('#archives/detail?id=' + ids + '')
                },
                error: function (data) {
                    $.myNotify.danger(data.msg);
                }
            })
        })

        //点击图片放大
        $("#img-zoom").click(function () {
            $('#img-modal').modal("hide");
        });
        $("#img-dialog").click(function () {
            $('#img-modal').modal("hide");
        });
        //index-list-content为显示文章内容div的class
        $(".images img").each(function (i) {
            var src = $(this).attr("src");
            $(this).click(function () {
                $("#img-zoom").attr("src", src);
                var oImg = $(this);
                var img = new Image();
                img.src = $(oImg).attr("src");
                var realWidth = img.width;//真实的宽度
                var realHeight = img.height;//真实的高度
                var ww = $(window).width();//当前浏览器可视宽度
                var hh = $(window).height();//当前浏览器可视宽度
                $("#img-content").css({"top": 0, "left": 0, "height": "auto"});
                $("#img-zoom").css({"height": "auto"});
                if ((realWidth + 20) > ww) {
                    $("#img-content").css({"width": "100%"});
                    $("#img-zoom").css({"width": "99%"});
                } else {
                    $("#img-content").css({"width": realWidth + 20, "height": realHeight + 20});
                    $("#img-zoom").css({"width": realWidth, "height": realHeight});
                }
                if ((hh - realHeight - 40) > 0) {
                    $("#img-content").css({"top": (hh - realHeight - 40) / 2});
                }
                if ((ww - realWidth - 20) > 0) {
                    $("#img-content").css({"left": (ww - realWidth - 20) / 2});
                }
                $('#img-modal').modal();
            });
        });
    });

    function showhtfun(hturl) {
        window.open("/" + hturl);
    }

    $(".imagelimit").change(function(){
        var file = $(this)[0].files[0];
        if(file !=null && file!=undefined && file !="") {
            var name=file.name.toLowerCase();
            if (name.indexOf(".png") > 0 ||name.indexOf(".jpg") > 0 ||name.indexOf(".pdf") > 0 || name.indexOf(".rar") > 0 || name.indexOf(".zip") > 0 || name.indexOf(".jpeg") > 0 || name.indexOf(".gif") > 0 || name.indexOf(".bmp") > 0) {
            } else {
                alert("文件类型不支持");
                $(this).val("");
            }
        }
    })

    $('.form_datetime').datetimepicker({
        locale: 'zh-CN',
        language: 'zh-CN',
        format: "yyyy-mm-dd hh:ii:ss",
        sideBySide: true
    });
</script>